package org.banyan.senior.idempotent.controller;

import org.banyan.senior.idempotent.annotation.AutoDuplicateRequest;
import org.banyan.senior.idempotent.annotation.AutoIdempotent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author metalsbanyan
 * @version 1.0
 * @description: 业务接口 -- 示例
 * @date 2023/7/21 11:24
 */
@RestController
@AutoDuplicateRequest
public class DemoBusinessController {
    private static final Logger LOGGER = LoggerFactory.getLogger(DemoBusinessController.class);


    @AutoIdempotent(prefix = "add")
    @GetMapping("/index")
    public String index() {
        return "请求成功";
    }

    @AutoIdempotent(prefix = "post")
    @PostMapping("/post")
    public String post(@RequestBody Map<String, Object> body) {
        return "请求成功" + body;
    }

    @GetMapping("/no")
    public String no(){
        return "no";
    }
}
